package com.task.core.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.task.common.annotation.DataScope;
import com.task.common.domain.info.KeyAndValue;
import com.task.common.utils.uuid.UUID;
import com.task.core.domain.ConversionsInfo;
import com.task.core.dto.request.ConversionsRequestDTO;
import com.task.core.mapper.ConversionsMapper;
import com.task.core.service.ConversionsService;

/**
 * @author 迪迦.
 * @date 2024/11/4 14:27
 */
@Service
public class ConversionsServiceImpl implements ConversionsService {

  @Resource
  private ConversionsMapper conversionsMapper;

  @Override
  @DataScope(deptAlias = "dept", userAlias = "su")
  public List<ConversionsInfo> getConversionsByPage(ConversionsRequestDTO request) {
    return conversionsMapper.getConversionsByPage(request);
  }

  @Override
  public void addConversions(ConversionsRequestDTO request) {
    request.setCode(UUID.randomUUID().toString().replace("-", ""));
    conversionsMapper.addConversions(request);
  }

  //@Override
  //public void modifyConversions(ConversionsRequestDTO request) {
  //  conversionsMapper.modifyConversions(request);
  //}

  @Override
  public void deleteConversions(String conversionsCode, Long userId) {
    conversionsMapper.deleteConversions(conversionsCode, userId);
  }
}
